// BEGIN CUT HERE
// PROBLEM STATEMENT
// *** You may only submit a given problem once - no resubmissions will be accepted. ***Suppose there is a universal set called U containing the integers between 1 and size inclusive.  You will be given some subsets of U.  A subset of U is a set of numbers that are in U.  The set can contain no numbers (empty set), every number in U, or anything in between.  Each subset will be given as a string containing a single space-delimited list of the numbers in the set.  The Borel Field B (also called sigma-algebra) generated by subsets is the smallest collection of sets satisfying the following statements:

 1) All of the sets in subsets are in B,
 2) if X and Y are sets in B then X union Y is in B,
 3) if X is a set in B then the complement of X is in B. 

Given two sets of numbers, the union is the set of all numbers that are in either or both.  The complement of a set X contains all numbers that are in U but not in X (if U=X the complement of X is empty).  Given subsets you will return how many distinct sets are in the Borel Field it generates.  When comparing sets to see if they are distinct, note that duplicate elements within a set are ignored.  In other words, a set does not have any duplicates, but a description of the set may.  For example, the sets "1 1 2", "1 2", and "2 2 1" are indistinguishable as sets, but "1 2 3" is distinct from the previous three.

DEFINITION
Class:BorelSets
Method:howMany
Parameters:int, vector <string>
Returns:int
Method signature:int howMany(int size, vector <string> subsets)


CONSTRAINTS
-size will be between 1 and 10 inclusive.
-subsets will contain between 1 and 50 elements inclusive.
-Each element of subsets will contain between 0 and 50 characters inclusive.
-Each element of subsets will either be an empty string, or a single space-delimited list of integers.  Each integer in the list will be between 1 and size inclusive, and will have no leading zeros.
-Each element of subsets will not have any leading or trailing spaces.


EXAMPLES

0)
4
{"1 2",""}

Returns: 4

We have that 
   U = "1 2 3 4".
We know "1 2", and "" are in the resultant Borel Field.  By taking the complement of "1 2" we get "3 4".  By taking the complement of "" we get "1 2 3 4".  There are no other sets in the Borel Field.

1)
10
{"","1","2","3","4","5","6","7","8","9","10"}

Returns: 1024

2)
5
{"","1 1 2","1 1 2 2 1 1","","2 1 1"}

Returns: 4

#pragma warning(disable:4018)  // signed/unsigned mistatch
#pragma warning(disable:4244)  // w64 to int cast
#pragma warning(disable:4267)  // big to small -- possible loss of data
#pragma warning(disable:4786)  // long identifiers
#pragma warning(disable:4800)  // forcing int to bool
#pragma warning(disable:4996)  // deprecations
// END CUT HERE
#include "assert.h"
#include "ctype.h"
#include "float.h"
#include "math.h"
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#include "stdarg.h"
#include "time.h"
#include "algorithm"
#include "numeric"
#include "functional"
#include "utility"
#include "bitset"
#include "vector"
#include "list"
#include "set"
#include "map"
#include "queue"
#include "stack"
#include "string"
#include "sstream"
#include "iostream"
using namespace std;

// BEGIN CUT HERE
#define all(v) (v).begin(), (v).end()
typedef long long i64;
template <class T> void make_unique(T& v) {sort(all(v)); v.resize(unique(all(v)) - v.begin());}
#define TC_LOCAL_COMPILE
#ifdef TC_LOCAL_COMPILE
#include "hash_set"
#include "hash_map"
using namespace stdext;
#else
#include "ext/hash_set"
#include "ext/hash_map"
using namespace __gnu_cxx;
#endif
// END CUT HERE

struct BorelSets {
  int howMany(int size, vector <string> subsets) {
  }
};

// BEGIN CUT HERE
namespace moj_harness {
  int isinf(double x) {return !_finite(x);}
  int isnan(double x) {return _isnan(x);}
};
namespace moj_harness {
	int run_test_case(int);
	void run_test( int casenum ) {
		if ( casenum != -1 ) {
			if ( run_test_case( casenum ) == -1 )
				cerr << "Illegal input! Test case " << casenum << " does not exist." << endl;
			return;
		}
		
		int correct = 0, total = 0;
		for ( int i=0;; ++i ) {
			int x = run_test_case(i);
			if ( x == -1 ) {
				if ( i >= 100 ) break;
				continue;
			}
			correct += x;
			++total;
		}
		
		if ( total == 0 ) {
			cerr << "No test cases run." << endl;
		} else if ( correct < total ) {
			cerr << "Some cases FAILED (passed " << correct << " of " << total << ")." << endl;
		} else {
			cerr << "All " << total << " tests passed!" << endl;
		}
	}
	
	int verify_case( int casenum, const int &expected, const int &received ) { 
		cerr << "Example " << casenum << "... "; 
		if ( expected == received ) {
			cerr << "PASSED" << endl;
			return 1;
		} else {
			cerr << "FAILED" << endl;
			cerr << "    Expected: " << expected << endl; 
			cerr << "    Received: " << received << endl; 
			return 0;
		}
	}

	int run_test_case( int casenum ) {
		switch( casenum ) {
		case 0: {
			int size                  = 4;
			string subsets[]          = {"1 2",""};
			int expected              = 4;

			return verify_case( casenum, expected, BorelSets().howMany( size, vector <string>( subsets, subsets + ( sizeof subsets / sizeof subsets[0] ) ) ) );
		}
		case 1: {
			int size                  = 10;
			string subsets[]          = {"","1","2","3","4","5","6","7","8","9","10"};
			int expected              = 1024;

			return verify_case( casenum, expected, BorelSets().howMany( size, vector <string>( subsets, subsets + ( sizeof subsets / sizeof subsets[0] ) ) ) );
		}
		case 2: {
			int size                  = 5;
			string subsets[]          = {"","1 1 2","1 1 2 2 1 1","","2 1 1"};
			int expected              = 4;

			return verify_case( casenum, expected, BorelSets().howMany( size, vector <string>( subsets, subsets + ( sizeof subsets / sizeof subsets[0] ) ) ) );
		}

		// custom cases

/*      case 3: {
			int size                  = ;
			string subsets[]          = ;
			int expected              = ;

			return verify_case( casenum, expected, BorelSets().howMany( size, vector <string>( subsets, subsets + ( sizeof subsets / sizeof subsets[0] ) ) ) );
		}*/
/*      case 4: {
			int size                  = ;
			string subsets[]          = ;
			int expected              = ;

			return verify_case( casenum, expected, BorelSets().howMany( size, vector <string>( subsets, subsets + ( sizeof subsets / sizeof subsets[0] ) ) ) );
		}*/
/*      case 5: {
			int size                  = ;
			string subsets[]          = ;
			int expected              = ;

			return verify_case( casenum, expected, BorelSets().howMany( size, vector <string>( subsets, subsets + ( sizeof subsets / sizeof subsets[0] ) ) ) );
		}*/
		default:
			return -1;
		}
	}
}

int main() {
  moj_harness::run_test(-1);
} 
// END CUT HERE
